package com.xx.douyi.service.impl;

import cn.hutool.core.util.ReUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xx.douyi.service.BossZPService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * @Description: com.xx.douyi.service.impl
 * @Author: ruby
 * @CreateTime: 2023-02-13 17:40
 */
@Slf4j
@Service
public class BossZPServiceImpl implements BossZPService {
    @Override
    public Map getMsg(String time, String cookies) {
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
        log.info(String.valueOf(requestAttributes.getRequest().getRequestURL()));
        HashMap<String, String> headers = new HashMap<>();
        headers.put("cookie",cookies);
        String body = HttpUtil.createGet("https://www.zhipin.com/wapi/zprelation/friend/getGeekFriendList.json?page=1").addHeaders(headers).execute().body();
        HashMap hashMap = JSON.parseObject(body, HashMap.class);

        return hashMap;
    }
}
